package com.bigData.main.controller;

import com.bigData.main.service.CarCountService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;


@RestController
public class CarCountController {
    @Resource
    CarCountService cars;

    @RequestMapping("/countall")
    public List<Map<String, Object>> countCar() {
        return cars.countCar();
    }

    @RequestMapping("/countColor")
    public List<Map<String, Object>> countColor() {
        return cars.countColor();
    }

    @RequestMapping("/countPriceRange")
    public List<Map<String, Object>> countPriceRange() {
        return cars.countPriceRange();
    }

    @RequestMapping("/countMonthlySales")
    public List<Map<String, Object>> countMonthlySales() {
        return cars.countMonthlySales();
    }


    @RequestMapping("/countBrandRatio")
    public List<Map<String, Object>> countBrandRatio() {
        return cars.countBrandRatio();
    }

    @RequestMapping("/countUserQuantity")
    public List<Map<String, Object>> countUserQuantity() {
        return cars.countUserQuantity();
    }

    @RequestMapping("/countUserprice")
    public List<Map<String, Object>> countUserPrice() {
        return cars.countUserPrice();
    }

    @RequestMapping("/allUser")
    public Integer allUser() {
        return cars.allUser();
    }

    @RequestMapping("/unallCar")
    public Integer unAllCar() {
        return cars.unallCar();
    }

    @RequestMapping("/allStorage")
    public Integer allStorage() {
        return cars.allStorage();
    }

    @RequestMapping("/allStorageCount")
    public List<Map<String, Object>> allStorageCount() {
        return cars.allStorageCount();
    }

    @RequestMapping("/financialStats")
    public Map<String, Object> getFinancialStats(
            @RequestParam("startTime") String startTime,
            @RequestParam("endTime") String endTime) {
        return cars.getFinancialStats(startTime, endTime);
    }

}
